#include <iostream>
#include <queue>
using namespace std;

const int N = 1e5 + 10;
int a[N];

int main() {
    int n,k;
    cin >> n >> k;
    priority_queue<int,vector<int>,greater<int>> q;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
        q.push(a[i]);
    }
    int sum = 0;
    int t = 0;
    while(sum <= k)
    {
        int x = q.top();
        q.pop();
        q.push(x * 2);
        sum += x;
        t++;
    }
    cout << t - 1 << endl;
    


    return 0;
}
// 64 位输出请用 printf("%lld")